package com.ktjy.ch06.controller;

import com.ktjy.ch06.entity.SysUser;
import com.ktjy.ch06.service.ISysRoleService;
import com.ktjy.ch06.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 *  控制器
 * </p>
 *
 * @author liuqiaomiao
 * @since 2024-02-22
 * @ClassName SysUserController
 */
@Controller
@RequestMapping("/ch06/sysUser")
public class SysUserController {
    @Autowired
    ISysUserService sysUserService;
    @Autowired
    ISysRoleService sysRoleService;

    @RequestMapping("/list")
    public String list(Model model){
       List<SysUser> userList= sysUserService.getList();
//        for (int i = 0; i <userList.size() ; i++) {
//            userList.get(i).setRole(sysRoleService.getById(userList.get(i).getUsrRoleId()));
//        }

        model.addAttribute("userList",userList);
        return "user/list";

    }

}
